#include "Model.h"
#include "dl_dxf.h"

Model::Model()
{
}


bool Model::setup()
{
    return true;
}

bool Model::teardown()
{
    return false;
}



void Model::addPoint(const DL_PointData& data)
{
    DL_PointData* p_data = new DL_PointData( data.x, data.y, data.y );
    m_points.push_back( p_data );
}

void Model::addLine(const DL_LineData& data)
{
    DL_LineData* p_data = new DL_LineData( data.x1, data.y1, data.z1, data.x2, data.y2, data.z2 );
    m_lines.push_back(p_data);
}

void Model::addArc(const DL_ArcData& data)
{
    DL_ArcData* p_data = new DL_ArcData(data.cx, data.cy, data.cz, data.radius, data.angle1, data.angle2 );
    m_arcs.push_back( p_data );
}

void Model::addCircle(const DL_CircleData& data)
{
    DL_CircleData* p_data = new DL_CircleData(data.cx, data.cy, data.cz, data.radius);
    m_circles.push_back( p_data );
}

void Model::addPolyline(const DL_PolylineData& data)
{
    DL_PolylineData* p_data = new DL_PolylineData(data.number, data.m, data.n, data.flags);
    m_polylines.push_back( p_data );
}

void Model::addEllipse(const DL_EllipseData& data)
{
    DL_EllipseData* p_data = new DL_EllipseData(data.cx, data.cy, data.cz, data.mx, data.my, data.mz, data.ratio, data.angle1, data.angle2);
    m_ellipses.push_back( p_data );
}

bool Model::openDxfFile(char* path)
{
    bool res = false;
    DL_Dxf* p_dfx = new DL_Dxf;

    res = p_dfx->in(path, this);

    delete p_dfx;
    return res;
}